package com.hxtec.polaris.controller;

import com.hxtec.polaris.service.FileService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * @Describtion 文件服务
 * @Author yonyong
 * @Date 2019/12/18 14:23
 * @Version 1.0.0
 **/
@RestController
@RequestMapping(value = "file",produces = "application/json;charset=utf-8")
@CrossOrigin
@Api(value = "/file", tags = "文件服务")
public class FileController {

    @Autowired
    private FileService fileService;

    /**
     * 上传分类图片
     * @return
     */
    @PostMapping("/upload/category/image")
    public Object uploadCategoryImage(MultipartFile file, HttpServletRequest request){
        return fileService.uploadCategoryImage(file,request);
    }

    /**
     * 上传轮播图图片
     * @return
     */
    @PostMapping("/upload/carouse/image")
    public Object uploadCarouseImage(MultipartFile file, HttpServletRequest request){
        return fileService.uploadCarouseImage(file,request);
    }
}
